import {ReqGetGoods} from "@/api"
const state = {
    goods:{}
}

const mutations = {
    //同步更新 state 数据
    SAVE_GOODS(state,value){
        state.goods = value;
    }
}


const actions = {
    //异步请求商品数据
    async GetGoods({commit},params){
        //发送请求
        let data = await ReqGetGoods(params);
        // console.log(data);
        // 调用mutatios 中的方法 更新state 数据
        commit("SAVE_GOODS",data);
    }
}


const getters = {

}

export default {
    namespaced:true,
    state,
    mutations,
    actions,
    getters
}